package com.zxy.dept.mapper;

import com.zxy.dept.domain.Department;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DepartmentMapper {

    /**
     * 查询所有父级部门
     */
    @Select("select dept_id as deptId,dept_name as deptName,super_dept_id as superDeptId from `department` where super_dept_id = 0")
    List<Department> getTopDept();

    /**
     * 根据子id查询所有子部门
     */
    @Select("select dept_id as deptId,dept_name as deptName,super_dept_id as superDeptId from `department` where super_dept_id=#{deptId}")
    List<Department> getChildDept(String deptId);
}
